package com.iplug.servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/**
 * @author Bora SAYINER
 */
@WebServlet("/logoutservlet")
public class LogoutServlet extends HttpServletBase {

    private static final long serialVersionUID = 1L;

    @Override
    protected void execute(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Logger.getLogger(LogoutServlet.class).info(req.getRemoteUser() + " logout system.");
        req.getSession().invalidate();
        req.logout();
        resp.sendRedirect("index.jsp");
    }
}
